<!-- 上传案例 -->
<link rel="stylesheet" href="/css/apps/microcase/downlist.css">
<style type="text/css">
	.red{
		color:red;
	}
	.button-add{
		display: inline-block;
	    text-align: center;
	    width: 20%;
	    height: 40px;
	    line-height: 40px;
	    color: #fff;
	    background: linear-gradient(90deg, #29D5F6, #6840E0 );
	    border-radius: 2px;
	    border: 0;
	    box-shadow: 0 2px 17px 0 rgba(0,87,255,0.51);
	    cursor: pointer;
	    margin:28px 32px 24px 15px;
	}
	.add-hint{
		display: inline-block;
	    margin-bottom: 24px;
		font-family: PingFangSC-Medium;
		font-size: 14px;
		color: #B1B1B1;
		vertical-align:bottom;
	}
	.hint-a{
		color: #53CAE3;
	}
	table.user-table {
    width: 100%;
    table-layout: fixed;
	}
	table.user-table tr th,
	table.user-table tr td {
	 	word-break:keep-all;
	    white-space:nowrap; 
	    overflow:hidden;
	    text-overflow:ellipsis;
	}
	table.user-table tr th {
		background: #E7E7E7;
		border-radius: 3px;
		height: 30px;
		font-size: 14px;
		color: #4D4D4D;
		text-align: center;
		border: 3px solid #fff;
	}
	table.user-table tr td {
		height: 60px;
		font-size: 12px;
		color: #4D4D4D;
		text-align: center;
	}
	table.user-table tr{
	    border-bottom: 1px solid #ddd;
	}
	table.user-table tr:nth-of-type(even) {
		background: #EFEFEF;
		
	}
</style>
<div class="main layui-clear" style="padding-bottom: 33px;">
	<div class="fly-main layui-clear">
		<div class="wrap layui-clear">
			<div class="layui-bar">
				<div class="layui-breadcrumbs">
					<a class="home" href="/"></a>
					<i class="layui-icon">&#xe602;</i>
			  		<a href="/microcase/downlist.html">案例</a>
			  		<i class="layui-icon">&#xe602;</i>
			  		<a href="/microcase/approvecaseindex.html">已审核案例</a>
				</div>
			</div>
			<#include "/apps/user/userTopInformation.html">
			<div class="home-left ukefu-profile-menu">
				<#include "/apps/user/userinfo.html">
			</div>
			<div class="home-right ukefu-profile" id="commenttopic">
				<div class="content">
					<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
						<#include "/apps/microcase/casemenu.html">
						<div class="layui-tab-content">
							<a href="/microcase/add.html" class="layui-btn button-add pc">上传新案例</a>
							<div class="layui-tab-item layui-show">
								<div class="layui-clear">
								 <table class="user-table pc">
							    	<thead>
								    	<tr>
									    	<th width="30%">案例</th>
									    	<th width="10%">下载人数</th>
									    	<th width="10%">价格</th>
									    	<th width="20%">发布时间</th>
									    	<th width="20%">操作</th>
								    	</tr>
							    	</thead>
							    	<tbody>
								    	<#if microcaseList??>
										<#list microcaseList.content as list>
								    	<tr>
									    	<td title="${list.title!}"><a href="/admin/microcase/hotDetail/${list.id!''}.html?id=${list.id!''}">${list.title!}</a></td>
									    	<td>${list.downnums!''}</td>
									    	<td>
									    		<#if list.price?? && list.price?string('')=='0'>
													免费
												<#else>
													<span class="layui-elip red">￥&nbsp;${list.price?string('0.00')}</span>
												</#if>
									    	</td>
									    	<td title="${list.releasetime!?string("yyyy-MM-dd")}">${list.releasetime!?string("yyyy-MM-dd")}</td>
									    	<td> 
									    	<!-- <a href="/microcase/edit.html?id=${list.id!''}">修改</a> -->
										    <a href="javascript:;" onclick="deleteFile('${list.id!''}');" class="red">删除</a>
										    </td>
								    	</tr>
										</#list>
										<#else>
										<tr>
									    	<td colspan="5"><i style="font-size:14px;">没有任何案例</i></td>
								    	</tr>
										</#if>
							    	</tbody>
							    </table>
							    <div class="phone-ul">
							    	<ul>
							    		<#if microcaseList??>
										<#list microcaseList.content as list>
								    	<li>
								    		<div class="phone-li-title layui-elip">
								    			<a class="case-title layui-elip" title="${list.title!}" href="/admin/microcase/hotDetail/${list.id!''}.html?id=${list.id!''}"">${list.title!}</a>
								    			<a href="javascript:;" onclick="deleteFile('${list.id!''}');" class="red operate">删除</a>
								    		</div>
									    	<div class="phone-li-bottm">
									    		<span><span class="price">￥${list.price!?string('0.00')}</span> | 下载量&nbsp;${list.downnums!''}</span>
									    		<div>
									    			<span>${list.releasetime!?string("yyyy-MM-dd")}</span>
									    		</div>
									    	</div>
								    	</li>
										</#list>
										</#if>
							    	</ul>
							    </div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div style="text-align: center" class="front-desk">
				<div class="laypage-main" id="pages"></div>
			</div>
		</div>
	</div>
</div>
</div>
<script>
var anlist = [];
<#list microcaseList.content as list>
anlist.push({"id":"${list.id!''}","title":"${list.title!''}"});
</#list>
console.log("上传案例：anlist==》",anlist);

layui.use(['laypage', 'layer'], function(){
	var laypage = layui.laypage;
  	laypage({
	    cont: 'pages'
	    ,first:'首页'
	    ,last:'末页'
	    ,pages: ${microcaseList.totalPages!"1"}
	    ,curr:${microcaseList.number+1}
	    ,skin: '#32c24d'
    	,skip: true
	    ,jump:function(obj, first){
	    	var curr = obj.curr;
	    	if (!first) {
               location.href = '/microcase/approvecaseindex?p=' + curr + "<#if RequestParameters['q']?? && RequestParameters['q'] != ''>&q=${RequestParameters['q']}</#if>";
            }
	    }
	});
});

function deleteFile(id){
	$.ajax({
		type: "POST",
		url: "/microcase/delete.html" ,
		dataType: "text",
		data:{id:id},
		async: false,
		beforeSend:function(){
			
		},
		success: function(data) {
			
			if(data == "success"){
	       		 window.location.href = "/microcase/approvecaseindex.html";
	       	 }else{
	       		 alert("失败！");
	       	 }
		}
		
	});
}
</script>